#pragma once

#include <QPushButton>
#include <QLayout>
#include <QLabel>
#include <QLineEdit>
#include <QDialog>
#include <QPushButton>
#include <QStackedWidget>
#include <QRadioButton>
#include <QButtonGroup>
#include <QPointer>

class ArrayHandler;
class Array2DDialog : public QDialog
{
	Q_OBJECT

public:
	Array2DDialog(ArrayHandler* arrayHandler, QWidget *parent = nullptr);
	~Array2DDialog();
	void setUI();
	bool arrayCopy();
	void cmdInput();
	void keyPressEvent(QKeyEvent* event);
	void closeEvent(QCloseEvent *);
	void setButtonEnable(bool flag);
	QPointer<ArrayHandler> m_array2DHandler;
public slots:
	void rectangleClick();
	void roundClick();
	void switchWidget(int index);
	void onSelect();
	void preview();
	void confirm();
	void cancel();
private:
	//阵列类型按钮
	QButtonGroup* m_arrayTypeGroup;
	QRadioButton* rectButton;
	QRadioButton* roundButton;
	//选择对象按钮
	QPushButton* pickButton;
	//布局
	QGridLayout* rectLayout;
	QGridLayout* roundLayout;
	//总的布局
	QVBoxLayout* mainLayout;
	//阵列方式布局
	QHBoxLayout*  m_arrayLayout;
	//确认、取消、预览按钮布局
	QHBoxLayout* m_buttonLayout;
	QStackedWidget* m_stackWidget;
	QWidget* rectangleWidget;
	QWidget* roundWidget;
	//矩形阵列输入框
	QLabel* rowNumberLabel;
	QLabel* rowDistanceLabel;
	QLabel* columnNumberLabel;
	QLabel* columnDistanceLabel;
	QLabel* ArrayCopyAngleLabel;

	QLineEdit* rowNumberEdit;
	QLineEdit* rowDistanceEdit;
	QLineEdit* columnNumberEdit;
	QLineEdit* columnDistanceEdit;
	QLineEdit* arrayCopyAngleEdit;
	//环形阵列输入框
	QLabel* centerLabel;
	QLabel* xLabel;
	QLabel* yLabel;
	QLabel* totalCountLabel;
	QLabel* fillAngleLabel;

	QLineEdit* xCoordinateEdit;
	QLineEdit* yCoordinateEdit;
	QLineEdit* totalCountEdit;
	QLineEdit* fillAngleEdit;
	//确认取消预览按钮
	QPushButton* confirmButton;
	QPushButton* cancelButton;
	QPushButton* previewButton;
};